package com.weavernorth.sysap.timer;

import com.weavernorth.sysap.service.SyncOrgStrucService;
import com.weavernorth.sysap.service.SyncOrgStrucServiceImpl;
import com.weavernorth.util.Logger4jUtil;
import org.apache.log4j.Logger;
import weaver.general.BaseBean;
import weaver.interfaces.schedule.BaseCronJob;

import java.util.Date;

import static weaver.common.DateUtil.getDateTime;

/**
 * @program: Erdos_ecology
 * @description: 同步分部&部门
 * @author: brusee
 * @create: 2021-07-02 10:34
 **/


public class ZsyncDepTimer extends BaseCronJob {
//    private Logger log = Logger4jUtil.getLoggerByName("/Timmer/ZsyncDepTimer_Log/");
    private Logger log = new Logger4jUtil().getLogger("/Timmer/ZsyncDepTimer_Log/");
    @Override
    public void execute() {
        try {
            SyncOrgStrucService sosService = new SyncOrgStrucServiceImpl();
            log.info("===========================部门同步开始======================================");
            Long begin_ry = new Date().getTime();
            log.info("部门同步开始时间："+getDateTime());

            sosService.syncOrgInfo(log,"0");

            Long end_ry = new Date().getTime();
            log.info("部门同步结束时间："+getDateTime());
            log.info("时间周期："+(end_ry - begin_ry) / (1000*60)+"分钟");
            log.info("===========================部门同步结束======================================");
        }catch (Exception ex){
            log.info("部门同步异常，异常信息："+ex.toString());
        }

    }
}
